package com.hccl.mongoEntities.action;

import DM.StateMachine;
import entities.Reply;
import entities.SLUResult;
import entities.StateNode;

import java.util.HashMap;

/**
 * Created by xjzhang on 2017/11/17.
 */
public class TransitionAction extends Action{

    public TransitionAction(){
        super();
    }

    @Override
    public void run(StateMachine stateMachine) throws Exception{
        try {
            onEnter(stateMachine);
            StateNode stateNode = stateMachine.model.stateNodeMap.get(actionParams.get(0));
            if (stateNode == null)
                throw new Exception("跳转的节点不存在。");
            if (stateNode!=null){
//                stateMachine.setCurrentState(stateNode);
//                for (Reply reply : stateNode.getReply())
//                    stateMachine.addDialogReply(reply);
//                stateMachine.transitToStateWithData(new SLUResult(actionParams.get(0),1.0,new HashMap<>()),"");
            }
        }finally {
            onExit(stateMachine);
        }
    }

}
